Class NotEqualsConstraint

java.lang.Object
edu.uky.ai.csp.kr.Constraint
edu.uky.ai.csp.kr.NotEqualsConstraint

public class NotEqualsConstraint
extends Constraint
Constrains two variables to have different values.
Author:
Stephen G. Ware
  • Field Summary

    Fields inherited from class edu.uky.ai.csp.kr.Constraint

    left, right
  • Constructor Summary

    Constructors 
    Constructor Description
    NotEqualsConstraint​(Variable left, Variable right)
    Constructs a new not equals constraint object.
  • Method Summary

    Modifier and Type Method Description
    protected boolean testValues​(Solution solution, java.lang.Object left, java.lang.Object right)
    A helper method for testing values which is defined for each new kind of constraint.
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • NotEqualsConstraint

      public NotEqualsConstraint​(Variable left, Variable right)
      Constructs a new not equals constraint object.
      Parameters:
      left - the left hand side of the constraint
      right - the right hand side of the constraint
  • Method Details

    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • testValues

      protected boolean testValues​(Solution solution, java.lang.Object left, java.lang.Object right)
      Description copied from class: Constraint
      A helper method for testing values which is defined for each new kind of constraint.
      Specified by:
      testValues in class Constraint
      Parameters:
      solution - the candidate solution, which provides context for the test
      left - the value for the left variable
      right - the value for the right variable
      Returns:
      false if these values would violate the constraint, true otherwise